<html>
<head><meta charset="utf-8"><title>Semantics Database Questions · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Semantics.20Database.20Questions.html">Semantics Database Questions</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="198588432"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Semantics%20Database%20Questions/near/198588432" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pksunkara <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Semantics.20Database.20Questions.html#198588432">(May 24 2020 at 15:47)</a>:</h4>
<p>Hey all. I have <code>CallExpr</code> syntax node. How do I resolve the the function semantically? For <code>MethodCallExpr</code> I did <code>semantics.resolve_method_call</code> like <span class="user-mention" data-user-id="203546">@Laurențiu Nicola</span> suggested. And I followed similarly for other stuff. But I am stumped for this. For example, I have a call expr <code>Subcommand::from("help")</code>. How can I find if <code>call_expr.expr</code> is resolved to <code>Subcommand::from</code>?</p>



<a name="198588563"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Semantics%20Database%20Questions/near/198588563" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pksunkara <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Semantics.20Database.20Questions.html#198588563">(May 24 2020 at 15:50)</a>:</h4>
<p>I want to catch cases for <code>(Subcommand::from)("help")</code> and <code>(|| Subcommand::from)()("help")</code> etc..</p>



<a name="198588576"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Semantics%20Database%20Questions/near/198588576" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pksunkara <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Semantics.20Database.20Questions.html#198588576">(May 24 2020 at 15:51)</a>:</h4>
<p>Or I guess, I could alternatively try to find whether <code>from</code> in a path expr end resolves to <code>Subcommand::from</code></p>



<a name="198597606"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Semantics%20Database%20Questions/near/198597606" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Semantics.20Database.20Questions.html#198597606">(May 24 2020 at 20:02)</a>:</h4>
<p>you get the type of the callee and inspect it, e.g. using <code>as_callable</code></p>



<a name="198640367"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Semantics%20Database%20Questions/near/198640367" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pksunkara <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Semantics.20Database.20Questions.html#198640367">(May 25 2020 at 07:16)</a>:</h4>
<p>Thanks, that worked.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>